//
//  ViewController.m
//  FAKER
//
//  Created by dllo on 15/11/2.
//  Copyright © 2015年 YHLai. All rights reserved.
//

#import "ViewController.h"
@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
    self.navigationController.navigationBar.translucent = 0;
    
    //添加夜间模式监听
    [self changeCurrentColor];
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(changeCurrentColor) name:@"change" object:nil];
}

#pragma mark 改变颜色
- (void)changeCurrentColor
{
    if (NSUSERDEFAULTS_NIGHT) {
        self.view.backgroundColor = BGCOLOR_BLACK;
        [self.navigationController.navigationBar setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[UIColor lightGrayColor], NSForegroundColorAttributeName, nil]];
        [[UINavigationBar appearance] setTintColor:[UIColor lightGrayColor]];
    }
    else {
        self.view.backgroundColor = BGCOLOR_WHITE;
        [self.navigationController.navigationBar setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[UIColor whiteColor], NSForegroundColorAttributeName, nil]];
        [[UINavigationBar appearance] setTintColor:[UIColor whiteColor]];
    }
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
